﻿using System.Collections.Generic;
using System.Web.Mvc;
using System.Web.Routing;
using Orchard.Mvc.Routes;

namespace OrchardPo {
    public class Routes : IRouteProvider {
        public void GetRoutes(ICollection<RouteDescriptor> routes) {
            foreach (var routeDescriptor in GetRoutes())
                routes.Add(routeDescriptor);
        }

        public IEnumerable<RouteDescriptor> GetRoutes() {
            return new[] {
                new RouteDescriptor {
                    Route = new Route(
                        "localize",
                        new RouteValueDictionary {
                            {"area", "OrchardPo"},
                            {"controller", "Localization"},
                            {"action", "Index"}
                        },
                        new RouteValueDictionary(),
                        new RouteValueDictionary {
                            {"area", "OrchardPo"}
                        },
                        new MvcRouteHandler()
                    )
                },
                new RouteDescriptor {
                    Route = new Route(
                        "localize/remove",
                        new RouteValueDictionary {
                            {"area", "OrchardPo"},
                            {"controller", "Localization"},
                            {"action", "Remove"}
                        },
                        new RouteValueDictionary(),
                        new RouteValueDictionary {
                            {"area", "OrchardPo"}
                        },
                        new MvcRouteHandler()
                    )
                },
                new RouteDescriptor {
                    Route = new Route(
                        "localize/update",
                        new RouteValueDictionary {
                            {"area", "OrchardPo"},
                            {"controller", "Localization"},
                            {"action", "Update"}
                        },
                        new RouteValueDictionary(),
                        new RouteValueDictionary {
                            {"area", "OrchardPo"}
                        },
                        new MvcRouteHandler()
                    )
                },
                new RouteDescriptor {
                    Route = new Route(
                        "localize/upload",
                        new RouteValueDictionary {
                            {"area", "OrchardPo"},
                            {"controller", "Localization"},
                            {"action", "Upload"}
                        },
                        new RouteValueDictionary(),
                        new RouteValueDictionary {
                            {"area", "OrchardPo"}
                        },
                        new MvcRouteHandler()
                    )
                },
                new RouteDescriptor {
                    Route = new Route(
                        "localize/cleanup",
                        new RouteValueDictionary {
                            {"area", "OrchardPo"},
                            {"controller", "Localization"},
                            {"action", "Cleanup"}
                        },
                        new RouteValueDictionary(),
                        new RouteValueDictionary {
                            {"area", "OrchardPo"}
                        },
                        new MvcRouteHandler()
                    )
                },
                new RouteDescriptor {
                    Route = new Route(
                        "localize/download/{culture}",
                        new RouteValueDictionary {
                            {"area", "OrchardPo"},
                            {"controller", "Localization"},
                            {"action", "Download"}
                        },
                        new RouteValueDictionary(),
                        new RouteValueDictionary {
                            {"area", "OrchardPo"}
                        },
                        new MvcRouteHandler()
                    )
                },
                new RouteDescriptor {
                    Route = new Route(
                        "localize/Root/{culture}",
                        new RouteValueDictionary {
                            {"area", "OrchardPo"},
                            {"controller", "Localization"},
                            {"action", "DetailsRoot"}
                        },
                        new RouteValueDictionary(),
                        new RouteValueDictionary {
                            {"area", "OrchardPo"}
                        },
                        new MvcRouteHandler()
                    )
                },
                new RouteDescriptor {
                    Route = new Route(
                        "localize/Core/{culture}",
                        new RouteValueDictionary {
                            {"area", "OrchardPo"},
                            {"controller", "Localization"},
                            {"action", "DetailsCore"}
                        },
                        new RouteValueDictionary(),
                        new RouteValueDictionary {
                            {"area", "OrchardPo"}
                        },
                        new MvcRouteHandler()
                    )
                },
                new RouteDescriptor {
                    Route = new Route(
                        "localize/Module/{module}/{culture}",
                        new RouteValueDictionary {
                            {"area", "OrchardPo"},
                            {"controller", "Localization"},
                            {"action", "DetailsModule"}
                        },
                        new RouteValueDictionary(),
                        new RouteValueDictionary {
                            {"area", "OrchardPo"}
                        },
                        new MvcRouteHandler()
                    )
                },
                new RouteDescriptor {
                    Route = new Route(
                        "localize/Theme/{theme}/{culture}",
                        new RouteValueDictionary {
                            {"area", "OrchardPo"},
                            {"controller", "Localization"},
                            {"action", "DetailsTheme"}
                        },
                        new RouteValueDictionary(),
                        new RouteValueDictionary {
                            {"area", "OrchardPo"}
                        },
                        new MvcRouteHandler()
                    )
                },
                new RouteDescriptor {
                    Route = new Route(
                        "localize/{*path}",
                        new RouteValueDictionary {
                            {"area", "OrchardPo"},
                            {"controller", "Localization"},
                            {"action", "Details"}
                        },
                        new RouteValueDictionary(),
                        new RouteValueDictionary {
                            {"area", "OrchardPo"}
                        },
                        new MvcRouteHandler()
                    )
                },
            };
        }
    }
}